<?php

/**
 * Celebrityvote form base class.
 *
 * @method Celebrityvote getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCelebrityvoteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'create_time'  => new sfWidgetFormDateTime(),
      'update_time'  => new sfWidgetFormDateTime(),
      'celebrity_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'add_empty' => true)),
      'order_i'      => new sfWidgetFormInputText(),
      'vote_i'       => new sfWidgetFormInputText(),
      'vote_mask_i'  => new sfWidgetFormInputText(),
      'theme'        => new sfWidgetFormChoice(array('choices' => array('男偶像投票' => '男偶像投票', '女偶像投票' => '女偶像投票', '组合投票' => '组合投票'))),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'create_time'  => new sfValidatorDateTime(array('required' => false)),
      'update_time'  => new sfValidatorDateTime(array('required' => false)),
      'celebrity_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'required' => false)),
      'order_i'      => new sfValidatorInteger(array('required' => false)),
      'vote_i'       => new sfValidatorInteger(array('required' => false)),
      'vote_mask_i'  => new sfValidatorInteger(array('required' => false)),
      'theme'        => new sfValidatorChoice(array('choices' => array(0 => '男偶像投票', 1 => '女偶像投票', 2 => '组合投票'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('celebrityvote[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Celebrityvote';
  }

}
